package com.ca.ridersclubapplication.view.header;

import android.app.Activity;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;

import com.ca.ridersclubapplication.view.card.BannerCard;
import com.ca.ridersclubapplication.view.list.ClubSquareListView;
import com.ca.ridersclubapplication.R;

public class MainHeaderView extends ConstraintLayout {

    private Activity activity;

    public BannerCard bannerCard;
    public ClubSquareListView clubSquareListView;

    public MainHeaderView(@NonNull Context context) {
        super(context);
        initView(context);
    }

    public MainHeaderView(@NonNull Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        initView(context);
    }

    public MainHeaderView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        initView(context);
    }

    private void initView(Context context) {

        View view = LayoutInflater.from(context).inflate(R.layout.main_header_layout, this);

        bannerCard = view.findViewById(R.id.card_banner);
        clubSquareListView = view.findViewById(R.id.lv_clubSquare);
    }

    public void setActivity(Activity activity) {
        this.activity = activity;
        clubSquareListView.setActivity(activity);
    }
}
